Skip to content

Stop format command from converting local clones to shallow clones#900

Merged
tjementum merged 1 commit into
mainfrom
pp-1309-fix-format-shallowing-local-clones
May 21, 2026
Merged

Stop format command from converting local clones to shallow clones#900
tjementum merged 1 commit into
mainfrom
pp-1309-fix-format-shallowing-local-clones

Conversation

@tjementum
Copy link
Copy Markdown
Member

@tjementum tjementum commented May 21, 2026

Summary & Motivation

The developer CLI's format command silently converted full local clones into shallow clones. GitHelper.GetChangedCsFilesInDirectory ran git fetch origin main --depth=1 before computing the changed-.cs diff, with the stated goal of supporting shallow CI checkouts. Against a full clone, that fetch creates .git/shallow containing the tip of origin/main — truncating main's reachable history to a single commit on the developer's machine. The change is silent and only becomes visible later when a Git GUI renders main as disconnected from its own history. Recovery requires git fetch --unshallow, which is not discoverable.

Auditing the workflows that actually call format (code-style.yml, account.yml, main.yml), every one of them already checks out with fetch-depth: 0. The shallow workaround is dead code in every environment in which it runs — it cannot help CI (CI is already full) and only harms local developers. If a future workflow ever needs to run format against a shallow checkout, the right place to fix that is at the checkout step, not in GitHelper.

The depth-1 fetch is removed outright and the inline comment rewritten to make the new contract explicit: the method relies on the caller's environment to keep origin/main reasonably current.

Checklist

  • I have added tests, or done manual regression tests
  • I have updated the documentation, if necessary

@linear
Copy link
Copy Markdown

linear Bot commented May 21, 2026

PP-1309

@tjementum tjementum moved this to 🏗 In Progress in Kanban board May 21, 2026
@tjementum tjementum self-assigned this May 21, 2026
@tjementum tjementum added the Bug Something isn't working label May 21, 2026
@sonarqubecloud
Copy link
Copy Markdown

@tjementum tjementum merged commit 205b671 into main May 21, 2026
9 of 12 checks passed
@tjementum tjementum deleted the pp-1309-fix-format-shallowing-local-clones branch May 21, 2026 17:30
@github-project-automation github-project-automation Bot moved this from 🏗 In Progress to ✅ Done in Kanban board May 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something isn't working

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

1 participant